package truef.service.reorder.service;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import edu.zut.cs.software.base.service.GenericGenerator;
import truef.reorder.domain.ReturnOrder;
import truef.reorder.domain.ReturnWindow;

public class ReorderEntityGenenrator  extends GenericGenerator{

	@Autowired
	ReturnOrderManager returnOrderManager;
	
	@Autowired
	ReturnWindowManager returnWindowManager;
	
	@Test
    public void gen_returnWindow(ReturnWindow re) {
        for (int i = 0; i < 2; i++) {
        	ReturnWindow r = new ReturnWindow();
            r.setEntityName("returnWindow_" + i);
            this.returnWindowManager.save(r);
            for (int j = 0; j < 2; j++) {
            	ReturnWindow returnWindow = new ReturnWindow();
            	returnWindow.setEntityName("returnWindow_" + i + "_" + j);
            	returnWindow.setParent(r);
                r = this.returnWindowManager.save(returnWindow);
                this.gen_returnWindow(r);
            }
        }
    }
	
	public void gen_returnOrder(ReturnOrder r) {
		for (int i = 0; i < 2; i++) {
			ReturnOrder returnOrder = new ReturnOrder();
			returnOrder.setEntityName("returnOrderName_" + i);
            this.returnOrderManager.save(returnOrder);
        }
	}

}
